package com.twu.biblioteca;

import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;

/**
 * Created with IntelliJ IDEA.
 * User: mbokhari
 * Date: 11/07/2013
 * Time: 12:56
 * To change this template use File | Settings | File Templates.
 */
public class LibraryNumberGenerator {
    private long libraryNumber = 1111111;

    public String formatLibraryNumber(long number) {

        DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols();
        decimalFormatSymbols.setGroupingSeparator('-');


        String template = "###,####";
        DecimalFormat formatter = new DecimalFormat(template, decimalFormatSymbols);
        formatter.setGroupingSize(4);
        String formattedLibraryNumber = formatter.format(number);
        return formattedLibraryNumber;
    }

    public long generateNewLibraryNumber() {
        return libraryNumber = libraryNumber + 1;
    }
}
